<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('出入库口')"/>
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								编码：<input type="text" name="code"/>
							</li>
							<li>
								名称：<input type="text" name="name"/>
							</li>
							<li>
								类型：
								<select name="type">
									<option value="">全部</option>
									<option value="1">入库口</option>
									<option value="2">出库口</option>
								</select>
							</li>
							<li>
								状态：<input type="text" name="state"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:door:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:door:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:door:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:door:export">
					<i class="fa fa-download"></i> 导出
            </a>
<a class="btn btn-primary" onclick="$.table.print()">
            <i class="fa fa-plus"></i> 打印
</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true" style="white-space: nowrap"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:door:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:door:remove')}]];
        var prefix = ctx + "system/door";

        $(function () {
            var options = {
                url: prefix + "/findList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "出入库口数据",
		        showExport: false,
                columns: [
					{
						checkbox: true
					},
					{
						field: 'id',
						title: 'ID',
						align: 'center',
						visible: false
					},
					{
						field: 'code',
						title: '编码',
						align: 'center',
						visible: true
					},
					{
						field: 'name',
						title: '名称',
						align: 'center',
						visible: true
					},
					{
						field: 'addressCode',
						title: 'AGV地址码',
						align: 'center',
						visible: true
					},
					{
						field: 'type',
						title: '类型',
						align: 'center',
						visible: true,
						formatter: function(value, row, index){
							if(value == 1){
								return "入库口";
							}else if(value == 2){
								return "出库口";
							}
						}
					},
					{
						field: 'state',
						title: '状态',
						align: 'center',
						visible: true
					},
					{
						field: 'wareName',
						title: '仓库',
						align: 'center',
						visible: true
					},
					{
						title: '操作',
						align: 'center',
						formatter: function(value, row, index){
							var actions = [];
							actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
							actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
							return actions.join('');
						}
					}
				]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
